﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LingDong.ConfigProvider
{
    public class StopWord
    {
        public static Dictionary<string, int> Get()
        {
            if (stopWord == null)
            {
                GetStopWord();
            }
            return stopWord;
        }

        private static void GetStopWord()
        {
            string file = ConfigCommon.Default.ConfigDir +
                ConfigCommon.Default.SentenceSplitterFName;
            string []stopWordList = GetTxtAsStringArray.Get(file);
            stopWord = new Dictionary<string, int>();
            foreach (string stop in stopWordList)
            {
                stopWord.Add(stop, 1);
            }
        }

        private static Dictionary<string, int> stopWord;
    }
}
